
@setlocal
@REM use utf8
chcp 65001

rmdir /s /q build
rmdir /s /q install

set ANDROID_SDK_HOME=D:/app/Android/Sdk
set ANDROID_NDK=%ANDROID_SDK_HOME%/ndk/16.1.4479499
set CMAKE_BIN=%ANDROID_SDK_HOME%/cmake/3.22.1/bin
set CMAKE_EXE=%CMAKE_BIN%/cmake.exe
set NINJA_EXE=%CMAKE_BIN%/ninja.exe

@REM arm64-v8a
%CMAKE_EXE% -DCMAKE_INSTALL_PREFIX=./install -S ./ -B ./build ^
    -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%/build/cmake/android.toolchain.cmake ^
    -DANDROID_ABI=arm64-v8a ^
    -DANDROID_NDK=%ANDROID_NDK% ^
    -DANDROID_NATIVE_API_LEVEL=16 ^
    -DANDROID_TOOLCHAIN=clang ^
    -DCMAKE_GENERATOR="Ninja" ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_MAKE_PROGRAM=%NINJA_EXE% ^
    -DANDROID_STL=c++_static

%CMAKE_EXE% --build ./build --config Release
%CMAKE_EXE% --install ./build --config Release

@REM x86_64
%CMAKE_EXE% -DCMAKE_INSTALL_PREFIX=./install -S ./ -B ./build ^
    -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%/build/cmake/android.toolchain.cmake ^
    -DANDROID_ABI=x86_64 ^
    -DANDROID_NDK=%ANDROID_NDK% ^
    -DANDROID_NATIVE_API_LEVEL=16 ^
    -DANDROID_TOOLCHAIN=clang ^
    -DCMAKE_GENERATOR="Ninja" ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_MAKE_PROGRAM=%NINJA_EXE% ^
    -DANDROID_STL=c++_static

%CMAKE_EXE% --build ./build --config Release
%CMAKE_EXE% --install ./build --config Release

@endlocal